package net.zdsoft.wpchat.support.enums;

/**
 * 后台用户状态枚举
 *
 * @author xuan
 */
public enum OperatorStateEnum {
    UNUSEABLE(0), STATE_ACTIVE(1);

    int value;

    public int getValue() {
        return value;
    }

    OperatorStateEnum(int value) {
        this.value = value;
    }

    public static OperatorStateEnum valueOf(int value) {
        OperatorStateEnum state = null;
        switch (value) {
        case 0:
            state = UNUSEABLE;
            break;
        case 1:
            state = STATE_ACTIVE;
            break;
        default:
            break;
        }
        return state;
    }

    public String getDescription() {
        String desc = null;
        switch (this) {
        case UNUSEABLE:
            desc = "停用";
            break;
        case STATE_ACTIVE:
            desc = "正常";
            break;
        default:
            break;
        }
        return desc;
    }

    @Override
    public String toString() {
        return getDescription();
    }

    public boolean equals(OperatorStateEnum state) {
        if (state == null) {
            return false;
        }
        return value == state.value;
    }

    public boolean equals(int value) {
        return this.value == value;
    }

}
